n = 78

def CalcOne(n):
    if n == 0:
        return 0

    count = 0

    while n > 0:
        count += n % 2
        n //= 2

    return count

def Solve(n):
    oneNum = CalcOne(n)
    while True:
        n += 1
        if CalcOne(n) == oneNum:
            break

    return n

print(Solve(78))
    
